package com.myblog.myblog.controller;

import com.myblog.myblog.service.AdminBlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/head")
public class ArchivesController {
    @Autowired
    private AdminBlogService adminBlogService;

    @GetMapping("/archives")
    public String archives(Model model){
        model.addAttribute("archiveMap",adminBlogService.archiveBlog());
        model.addAttribute("blogCount",adminBlogService.countBlog());
        return "head/archives";
    }
}
